package com.sright.bcard.user.dal.dao.impl;

import com.sright.bcard.common.service.share.base.dao.BaseDAOImpl;
import com.sright.bcard.common.service.share.base.dao.BaseMapper;
import com.sright.bcard.common.service.share.dto.page.PageParamRequest;
import com.sright.bcard.user.dal.dao.VisitorDAO;
import com.sright.bcard.user.dal.entity.VisitorDO;
import com.sright.bcard.user.dal.mapper.VisitorMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Repository
public class VisitorDAOImpl extends BaseDAOImpl<VisitorDO> implements VisitorDAO {

    @Resource
    private VisitorMapper visitorMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return visitorMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<VisitorDO> selectByEnterpriseId(Long enterpriseId) {
        return visitorMapper.selectByEnterpriseId(enterpriseId);
    }

    @Override
    public List<VisitorDO> selectByEnterpriseIdAndMemberId(Long enterpriseId, Long visitorMemberId) {
        return visitorMapper.selectByEnterpriseIdAndMemberId(enterpriseId, visitorMemberId);
    }

    @Override
    public Integer getVisitTotalByEnterpriseIdAndMemberId(Long enterpriseId, Long visitorMemberId) {
        return visitorMapper.getVisitTotalByEnterpriseIdAndMemberId(enterpriseId, visitorMemberId);
    }

    @Override
    public VisitorDO selectByUserIdAndCardId(Long cardUserId, Long memberId) {
        return visitorMapper.selectByUserIdAndCardId(cardUserId,memberId);
    }

    @Override
    public VisitorDO selectByMmeberIdOrderTime(Long memberId) {
        return visitorMapper.selectByMmeberIdOrderTime(memberId);
    }

    @Override
    public Integer selectSum(Long userId, Long memberId) {
        return visitorMapper.selectSum(userId,memberId);
    }

    @Override
    public Integer selectCount(Long userId) {
        return visitorMapper.selectCount(userId);
    }

    @Override
    public List<VisitorDO> selectPageData(PageParamRequest paramRequest, Long userId, String order, Long memberId) {
        return visitorMapper.selectPageData(paramRequest,userId,order,memberId);
    }

    @Override
    public Integer selectCountBetweenDate(Long userId, Date beginDate, Date endDate) {
        return visitorMapper.selectCountBetweenDate(userId,beginDate,endDate);
    }

    @Override
    public List<VisitorDO> selectAllData(Long userId, Long memberId) {
        return visitorMapper.selectAllData(userId,memberId);
    }

    @Override
    public Integer selectSumTotalByEnterpriseId(Long enterpriseId) {
        return visitorMapper.selectSumTotalByEnterpriseId(enterpriseId);
    }

    @Override
    protected BaseMapper<VisitorDO> getObjMapper() {
        return visitorMapper;
    }
}
